package xyz.zhzby.cyzx.ucenter.controller;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import xyz.zhzby.cyzx.servicebase.domain.RestResponse;
import xyz.zhzby.cyzx.ucenter.dto.response.InterestResponse;
import xyz.zhzby.cyzx.ucenter.service.IInterestService;
import xyz.zhzby.cyzx.ucenter.service.IUserInterestService;

import java.util.List;

/**
 * @author zby
 * @date 2021/12/16
 */
@RestController
@RequestMapping("/ucenter/interest")
@ApiModel("用户兴趣相关API")
public class InterestController {

    @Autowired
    private IInterestService interestService;

    @Autowired
    private IUserInterestService userInterestService;

    @ApiOperation("获取所有兴趣信息")
    @GetMapping("")
    public RestResponse<List<InterestResponse>> getAllInterests() {
        return interestService.getAllInterests();
    }

    @ApiOperation("当前用户更新兴趣")
    @PutMapping("")
    public RestResponse<String> updateInterests(@RequestBody List<Long> ids) {
        return userInterestService.updateInterests(ids);
    }
}
